package com.briup.server.domain.dto;

import com.briup.common.constraints.Add;
import com.briup.common.constraints.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.util.List;

/**
 * 用户操作相关DTO对象，包括用户的新增、更新操作的DTO
 */
@Data
@Schema(description = "用户操作相关DTO实体")
public class UserModifiedDTO {
    @Null(groups = Add.class, message = "新增时用户id必须为空")
    @NotNull(groups = Update.class, message = "更新时用户id不能为空")
    @Schema(description = "用户id")
    private Long id;
    @NotBlank(message = "用户名不能为空")
    @Schema(description = "用户名")
    private String username;
    @NotBlank(message = "真实姓名不能为空")
    @Schema(description = "真实姓名")
    private String realname;
    @Email(message = "邮箱格式错误")
    @Schema(description = "邮箱")
    private String email;
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误")
    @Schema(description = "手机号")
    private String mobile;
    @Range(min = 0, max = 1, message = "状态值必须在0-1之间")
    @Schema(description = "状态: 0-禁用, 1-正常")
    private Byte status;
    @NotEmpty(message = "用户角色id列表不能为空")
    @Schema(description = "用户角色id列表")
    private List<Long> roleIds;
}
